<?php
/**
 * 友情链接管理
 *
 * @version   $Id: friendlink_main.php 1 8:48 2010年7月13日 $
 * @package   DedeCMS.Administrator
 * @founder   IT柏拉图, https://weibo.com/itprato
 * @author    DedeCMS团队
 * @copyright Copyright (c) 2007 - 2021, 上海卓卓网络科技有限公司 (DesDev, Inc.)
 * @license   http://help.dedecms.com/usersguide/license.html
 * @link      http://www.dedecms.com
 */
require_once dirname(__FILE__) . '/config.php';
require_once DEDEINC . '/datalistcp.class.php';
setcookie('ENV_GOBACK_URL', $dedeNowurl, time() + 3600, '/');

if (empty($keyword)) {
    $keyword = '';
}

if (empty($ischeck)) {
    $ischeck = 0;
    $ischeckSql = '';
} else {
    if ($ischeck == -1) {
        $ischeckSql = " And ischeck < 1 ";
    } else {
        $ischeckSql = " And ischeck='$ischeck' ";
    }

}

$selCheckArr = array(0 => '不限类型', -1 => '未审核', 1 => '内页', 2 => '首页');

$sql = "SELECT * FROM `#@__flink` WHERE  CONCAT(`url`,`webname`,`email`) LIKE '%$keyword%' $ischeckSql ORDER BY dtime desc";

$dlist = new DataListCP();
$dlist->SetParameter('keyword', $keyword);
$dlist->SetParameter('ischeck', $ischeck);
$dlist->SetTemplet(DEDEADMIN . '/templets/friendlink_main.htm');
$dlist->SetSource($sql);
$dlist->display();

function GetPic($pic)
{
    if ($pic == '') {
        return '无图标';
    } else {
        return "<img src='$pic' width='88px' height='31px' border='0' />";
    }

}

function GetSta($sta)
{
    if ($sta == 1) {
        return '内页';
    }

    if ($sta == 2) {
        return '首页';
    } else {
        return '未审核';
    }

}
